<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*;" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		System.out.println("Hello"); 
	%>
	
	 <%-- 
		<p>1234562</p>
	 --%>
	 
	 <!-- 
	 <%!
	 	private double randomNum() {
		 return Math.random();
	 }
	 %>
	  -->
	 
	 <%
	 	if (session.getAttribute("accessCount") == null) {
	 		out.println("<h1>欢迎访问本站点</h1>");
	 	} else {
	 		out.println("欢迎回来，这是您第" + (Integer)session.getAttribute("accessCount") + "次访问本站点");
	 	}
	 %>
 		<a href="<%=request.getContextPath()%>/servlet/Logout">退出</a>
	 
	 <h2>JSP Expression</h2>
	 <ul>
	 	<li>CurrentTime: <%= new Date() %></li>
	 	<li>Server Info: <%= application.getServerInfo() %></li>
	 	<li>Server Info: <% out.println(application.getServerInfo()); %></li>
	 	<li>random Value: <%= randomNum() %></li>
	 </ul>
	 
	 <h1><a href="<%=request.getContextPath()%>/servlet/showRequestHeader">Go to show RequestHeader Page</a></h1>
	 <h1><a href="<%=request.getContextPath()%>/servlet/dispatchToResult">dispatch to Result Page</a></h1>
	 <h1><a href="<%=request.getContextPath()%>/servlet/redirectToResult">redirect to Result Page</a></h1>
	 <h1><a href="<%=request.getContextPath()%>/servlet/showIterator">show iterator Page</a></h1>
	 
	 <h2>Form</h2>
	 <form action="<%=request.getContextPath()%>/servlet/getParameter" method="get">
	 	username: <input type="text" name="username"/><br>
	 	password: <input type="password" name="password"/><br><br>
	 address:&nbsp;	
	 	南京<input type="checkbox" name="address"/>&nbsp;
	 	北京<input type="checkbox" name="address"/>&nbsp;
	 	东京<input type="checkbox" name="address"/>&nbsp;
	 	西京<input type="checkbox" name="address"/>&nbsp; <br>
	 	
	 	<input type="submit" id="submit" value="submit"/>
	 </form>
	 
	 <hr>
	 
	 <h2>Expression Language</h2>	 
	 <ul>
	 	<li>\${1 + 2 - 3} = ${1 + 2 - 3} </li>
	 	<li>\${1 &lt; 3} = ${1 < 3} </li>
	 	<li>\${1 &lt; 3} = ${1 lt 3} </li>
	 	<li>\${1 &gt; 3} = ${1 > 3} </li>
	 	<li>\${1 &gt; 3} = ${1 gt 3} </li>
	 	<li>\${1 == 1} = ${1 eq 1} </li>
	 	<li>\${1 == 1} = ${1 == 1} </li>
	 	<li>\${1 == 1 ? "true" : "false"} = ${1 == 1 ? "true" : "false"} </li>
	 </ul>
	 
	 
</body>
</html>